import os
import sys
import re

# reduce是收敛过程，是对map处理的文件进行总和处理
if __name__=="__main__":
    handler=sys.stdin
    word_dict={}
    for line in handler:
        if not line:
            continue
        terms=line.strip().split(" ")
        for i in terms:
            if i in word_dict:
                word_dict[i]+=1;
            else:
                word_dict[i]=1

    for j in word_dict:
        print(j,word_dict[j])
